Method and device for locating an answer based on question and answer

ABSTRACT

The present disclosure discloses a method and a device for locating an answer based on question and answer, in which the method includes: receiving a query sentence; parsing the query sentence, to generate a semantic parse tree corresponding to the query sentence; matching the semantic parse tree with a pre-established matching base, to obtain an alignment probability between each of candidate answers in the pre-established matching base and the semantic parse tree; and determining a final answer according to the alignment probability.

CROSS-REFERENCE TO RELATED APPLICATION

The present application is based upon and claims priority to ChinesePatent Application No. 201611249487.2, filed on Dec. 29, 2016, theentirety contents of which are incorporated herein by reference.

FIELD

The present disclosure relates to an internet technology field, and moreparticularly to a method and a device for locating an answer based onquestion and answer.

BACKGROUND

Deep question and answer (DeepQA for short) means a technology which canunderstand languages of human, intelligently identify meanings of aquestion, and extract an answer to the question from a huge number ofinternet data.

With the rapid development of the internet, functions of the searchengine are becoming increasingly powerful, and an expectation of user tothe search engine is also getting higher and higher, starting to changefrom basic related webpage recall to the intelligent question andanswer. When a user input a question to be queried via the searchengine, the user expects to directly obtain an answer to the questionrather than related webpages.

However, search engine technology in the related art can only providewebpages with high relevance as the search results to the user by usinginformation retrieval technology and document summarization technology,and the user needs to determine webpages to be viewed in combinationwith webpage titles, text summary, or further webpage links and has tofind an answer from redundant text contents by himself. Therefore,answers that the user needs cannot be provided to the user intuitivelyand clearly in the related art.

SUMMARY

Embodiments of the present disclosure seek to solve at least one of theproblems existing in the related art to at least some extent.

For this, a first objective of the present disclosure is to provide amethod for locating an answer based on question and answer. With thismethod, it is unnecessary for the user to click links and find an answerfrom redundant text contents, and answers that the user needs can beprovided intuitively and clearly, thus deeply satisfying the searchservice demand of the user.

A second objective of the present disclosure is to provide a device forlocating an answer based on question and answer.

A third objective of the present disclosure is to provide a terminal.

A forth objective of the present disclosure is to provide anon-transitory computer-readable storage medium.

A fifth objective of the present disclosure is to provide a programproduct.

In order to achieve the above objectives, embodiments of a first aspectof the present disclosure provide a method for locating an answer basedon question and answer, including: receiving a query sentence; parsingthe query sentence, to generate a semantic parse tree corresponding tothe query sentence; matching the semantic parse tree with apre-established matching base, to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree; and determining a final answer according tothe alignment probability.

In order to achieve the above objectives, embodiments of a second aspectof the present disclosure provide a device for locating an answer basedon question and answer, including: a receiving module, configured toreceive a query sentence; a parsing module, configured to parse thequery sentence, to generate a semantic parse tree corresponding to thequery sentence; a matching module, configured to match the semanticparse tree with a pre-established matching base, to obtain an alignmentprobability between each of candidate answers in the pre-establishedmatching base and the semantic parse tree; and a determining module,configured to determine a final answer according to the alignmentprobability.

In order to achieve the above objectives, embodiments of a third aspectof the present disclosure provide a terminal, including: one or moreprocessors and a storage configured to store instructions executable bythe one or more processors, wherein the one or more processors areconfigured to execute following steps: receiving a query sentence;parsing the query sentence, to generate a semantic parse treecorresponding to the query sentence; matching the semantic parse treewith a pre-established matching base, to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree; and determining a final answer according tothe alignment probability.

In order to achieve the above objectives, embodiments of a forth aspectof the present disclosure provide a non-transitory computer-readablestorage medium, configured to store one or more programs, in which, whenthe one or more programs are executed by a processor of a mobileterminal, the mobile terminal is caused to execute a method for locatingan answer based on question and answer, including: receiving a querysentence; parsing the query sentence, to generate a semantic parse treecorresponding to the query sentence; matching the semantic parse treewith a pre-established matching base, to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree; and determining a final answer according tothe alignment probability.

In order to achieve the above objectives, embodiments of a fifthobjective of the present disclosure provide a program product, wheninstructions in the program product are executed by a processor, theprocessor is configured to execute a method for locating an answer basedon question and answer, including: receiving a query sentence; parsingthe query sentence, to generate a semantic parse tree corresponding tothe query sentence; matching the semantic parse tree with apre-established matching base, to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree; and determining a final answer according tothe alignment probability.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other aspects and advantages of embodiments of the presentdisclosure will become apparent and more readily appreciated from thefollowing descriptions made with reference to the drawings, in which:

FIG. 1 is a flow chart of a method for locating an answer based onquestion and answer according to an embodiment of the presentdisclosure;

FIG. 2 is a schematic diagram of obtaining an alignment probabilitybetween each of the candidate answers and the semantic parse treeaccording to an embodiment of the present disclosure;

FIG. 3 is a schematic diagram of a search result display interface of asearch engine applying the method for locating an answer based onquestion and answer according to an embodiment of the presentdisclosure;

FIG. 4 is a flow chart of a method for locating an answer based onquestion and answer according to another embodiment of the presentdisclosure;

FIG. 5 is a flow chart of establishing the matching base according to anembodiment of the present disclosure;

FIG. 6 is a schematic diagram of a statistical alignment result of aquestion and answer pair;

FIG. 7 is a schematic diagram of a device for locating an answer basedon question and answer according to an embodiment of the presentdisclosure;

FIG. 8 is a schematic diagram of a device for locating an answer basedon question and answer according to another embodiment of the presentdisclosure; and

FIG. 9 is a schematic diagram of a device for locating an answer basedon question and answer according to yet another embodiment of thepresent disclosure.

DETAILED DESCRIPTION

Reference will be made in detail to embodiments of the presentdisclosure. The same or similar elements and the elements having same orsimilar functions are denoted by like reference numerals throughout thedescriptions. The embodiments described herein with reference todrawings are explanatory, illustrative, and used to generally understandthe present disclosure. The embodiments shall not be construed to limitthe present disclosure. Instead, the embodiments of the presentdisclosure comprise all the variants, modifications and theirequivalents within the spirit and scope of the present disclosure asdefined by the claims.

With the development of the network information technology, the user'sdemand for a search engine cannot be satisfied with the basic relatedwebpage recall, and begins to change to a direction of intelligentquestion and answer. For example, when a user input a query sentence“Why is the sea salty” through the search engine, the user wishes todirectly obtain a reason why the sea is salty from a search resultdisplay interface.

However, the search engine in the related art can only provide searchresults which are related to a query sentence to the user by means oftraditional information retrieval technology and document summarizationtechnology. At the same time, words that can summarize webpage contentare extracted from the webpage by summary calculation and are providedto the user to assist the user in determining a content to be clicked.The user has to determine a webpage to be viewed in combination withwebpage titles, text summary, or further webpage links and find ananswer from redundant text contents by himself. It can be seen that, thesearch engine technology in the related art can not satisfy a demand fordirectly obtaining required answers from the search result displayinterface of the user.

Therefore, in order to compensate for the disadvantages in the relatedart, the present disclosure provides a method for locating an answerbased on question and answer, to intuitively and clearly provide answersthat the user needs in the search result display interface.

FIG. 1 is a flow chart of a method for locating an answer based onquestion and answer according to an embodiment of the presentdisclosure.

As shown in FIG. 1, the method for locating an answer based on questionand answer according to an embodiment of the present disclosure includesthe followings.

In block S11, a query sentence is received.

In an embodiment, when the user wants to acquire an answer to aquestion, for example, the user wants to know a reason why the sea issalty, the user can input a question (i.e., why is the sea salty) to bequeried in the search engine. The search engine receives the querysentence input by the user, and searches for answers.

In block S12, the query sentence is parsed, to generate a semantic parsetree corresponding to the query sentence.

In an embodiment, after the search engine receives the query sentenceinput by the user, the search engine further parses the query sentenceto generate the semantic parse tree corresponding to the query sentence.

In block S13, the semantic parse tree is matched with a pre-establishedmatching base, to obtain an alignment probability between each ofcandidate answers in the pre-established matching base and the semanticparse tree.

The alignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree includes aword alignment probability or a phrase alignment probability.

In an embodiment, after the query sentence is parsed and the semanticparse tree corresponding to the query sentence is obtained, the semanticparse tree is matched with the pre-established matching base, to obtainthe alignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree, i.e., toobtain a word alignment probability or a phrase alignment probabilitybetween each of the candidate answers in the pre-established matchingbase and the semantic parse tree.

Specifically, when obtained alignment probability is the word alignmentprobability, matching the semantic parse tree with a pre-establishedmatching base to obtain an alignment probability between each ofcandidate answers in the pre-established matching base and the semanticparse tree includes: obtaining an alignment probability of each part ofspeech in the semantic parse tree; and obtaining the word alignmentprobability according to the alignment probability of each part ofspeech in the semantic parse tree.

More specifically, the alignment probability of each part of speech inthe semantic parse tree can be obtained by the following formulas(1)-(4).

$\begin{matrix}{{Score}_{lat} = {\max\limits_{{word}_{i} \in {answer}}{{P\left( {word}_{i} \middle| {lat} \right)}*{P\left( {lat} \middle| {word}_{i} \right)}*{{weight}\left( {word}_{i} \right)}}}} & (1) \\{{Score}_{verb} = {\max\limits_{{word}_{i} \in {answer}}{{P\left( {word}_{i} \middle| {verb} \right)}*{P\left( {verb} \middle| {word}_{i} \right)}*{{weight}\left( {word}_{i} \right)}}}} & (2) \\{{Score}_{noun} = {\max\limits_{{word}_{i} \in {answer}}{{P\left( {word}_{i} \middle| {noun} \right)}*{P\left( {noun} \middle| {word}_{i} \right)}*{{weight}\left( {word}_{i} \right)}}}} & (3) \\{{Score}_{adj} = {\max\limits_{{word}_{i} \in {answer}}{{P\left( {word}_{i} \middle| {adj} \right)}*{P\left( {adj} \middle| {word}_{i} \right)}*{{weight}\left( {word}_{i} \right)}}}} & (4)\end{matrix}$

where, lat, verb, noun, and adj represent a core word of the question(query sentence), a verb, a noun, and an adjective of the questionrespectively, correspondingly, Score_(lat), Score_(verb), Score_(noun),and Score_(adj) represent an alignment probability of the core word ofthe question, an alignment probability of the verb, an alignmentprobability of the noun, and an alignment probability of the adjectiverespectively.

Taking calculating an alignment probability of the core word lat of thequestion as an example, all words in the candidate answer to be matchedare traversed, and for each word (word_(i),0<=i<=N, in which Nrepresents a number of words in the candidate answer to be matched) inthe candidate answer to be matched, a positive probability (representedby P(word_(i)|lat)) and a reverse probability (represented byP(lat|word_(i))) of the core word of the question are obtained, and thepositive probability P(word_(i)|lat), the reverse probabilityP(lat|word_(i)), and significance (represented by weight(word_(i))) ofthe word are multiplied together. A maximum value of obtained productsis the alignment probability of the core word of the question.

It should be noted that, in the query sentence input by the user, thecore word, the verb, the noun, and the adjective of the questiongenerally play a key role in matching process. Therefore, the alignmentprobabilities corresponding respectively to the core word, the verb, thenoun, and the adjective of the question are obtained in the method forlocating an answer based on question and answer according to the presentdisclosure.

After the alignment probability of each part of speech in the semanticparse tree is obtained, the word alignment probability can be obtainedaccording to the alignment probability of each part of speech in thesemantic parse tree by formula (5), which is shown as follows.

Score=(αScore_(lat)*βScore_(verb)*γScore_(noun)*δScore_(adj))*offset_punish  (5)

where, α, β, γ, and δ represent weights of the alignment probabilitiesof the core word of the question, the verb, the noun, and the adjectiverespectively, which can be obtained by training, and offset_punishrepresents a penalty of an offset.

When the alignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree is the phrasealignment probability, matching the semantic parse tree with apre-established matching base to obtain an alignment probability betweeneach of candidate answers in the pre-established matching base and thesemantic parse tree includes: calculating a product of an alignmentprobability of each of successfully matching phrases and a number ofwords in the respective successfully matching phrase, to obtain apositive probability and a reverse probability of each of thesuccessfully matching phrases, in which the successfully matchingphrases are phrases that are successfully matched between candidateanswers in the pre-established matching base and the semantic parsingtree; and obtaining a maximum value from the positive probability andthe reverse probability of each of the successfully matching phrases,and performing a weighted summation on obtained maximum values to obtainthe phrase alignment probability.

A formula for calculating the phrase alignment probability is shown asformula (6).

$\begin{matrix}{{Score}_{phrase} = {\sum\limits_{\underset{{phrase}_{j} \in {answer}}{{phrase}_{i} \in {query}}}{\max \left( {{{term\_ cnt}\left( {phrase}_{j} \right)*{P\left( {phrase}_{j} \middle| {phrase}_{i} \right)}},\mspace{20mu} {{term\_ cnt}\left( {phrase}_{i} \right)*{P\left( {phrase}_{i} \middle| {phrase}_{j} \right)}}} \right)}}} & (6)\end{matrix}$

where, phrase_(i) and phrase_(j) represent a phase in the question(query sentence) and a phase in the candidate answer to be matchedrespectively; Score_(phrase) represents the phrase alignmentprobability, term_cnt (phrase_(i)) and term_cnt (phrase_(j)) represent anumber of words in phrase_(i), and a number of words in phrase_(j)respectively; P(phrase_(i)|phrase_(j)) and P(phrase_(j)|phrase_(i))represent an alignment probability of phrase_(i) in the query relativeto phrased in the candidate answer to be matched, and an alignmentprobability of phrase_(j) in the candidate answer to be matched relativeto phrase, in the query, respectively.

FIG. 2 is a schematic diagram of obtaining an alignment probabilitybetween each of the candidate answers and the semantic parse treeaccording to an embodiment of the present disclosure.

As shown in FIG. 2, a query sentence input by the user is “How to printscreen in iPhone6”. After the query sentence is parsed, a correspondingsemantic parse tree containing “iPhone6”, “how”, and “print screen” isobtained. By matching the semantic parse tree with the pre-establishedmatching base, a candidate answer “HOME button and power switch of themobile phone can be pressed at the same time to realize screenshot” inthe pre-established matching base is obtained, and an alignmentprobability between the candidate answer and the semantic parse tree iscalculated by using above-mentioned formulas. It can be seen from FIG. 2that, “iPhone6” matches “mobile phone”, with an alignment probability of0.05, “how” matches “can” and “realize”, with an alignment probabilityof 0.05 and an alignment probability of 0.001 respectively, “printscreen” matches “screenshot”, with an alignment probability of 0.22. InFIG. 2, parts in dashed boxes represent phrases. It can be seen that,phrase “how to print screen” matches “press at the same time” and “powerswitch”, with an alignment probability of 0.45 and an alignmentprobability of 0.41 respectively.

In block S14, a final answer is determined according to the alignmentprobability.

In an embodiment, after the alignment probability between each ofcandidate answers in the pre-established matching base and the semanticparse tree is obtained, the final answer can be determined according tothe alignment probability.

Specifically, the candidate answers can be ranked according to the wordalignment probability and/or the phrase alignment probability, and acandidate answer having a highest ranking score is determined as thefinal answer.

In an embodiment, after the final answer is determined, correspondingprocessing, such as bolding, changing color of words, or the like, canbe performed on the final answer, and processed answer is displayed inthe search result display page.

FIG. 3 is a schematic diagram of a search result display interface of asearch engine applying the method for locating an answer based onquestion and answer according to an embodiment of the presentdisclosure.

As shown in FIG. 3, when the user input a query sentence “Why is the seasalty” in a search box 31, after bolding an answer corresponding to thequery sentence in the obtained search result, the search engine displaysprocessed search result in a display window 32. When the user views thesearch result in the display window 32, the user can directly obtainfrom the bolded words that, the reason why the sea is salty is that“with accumulation of salty materials in the ocean, the sea gets salterand salter”. It can be seen that, the method for locating an answerbased on question and answer according to embodiments of the presentdisclosure can help the user to obtain required information intuitivelyand quickly.

With the method for locating an answer based on question and answeraccording to embodiments of the present disclosure, by receiving thequery sentence, parsing the query sentence to generate the semanticparse tree corresponding to the query sentence, matching the semanticparse tree with the pre-established matching base, to obtain thealignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree, anddetermining the final answer according to the alignment probability, itis unnecessary for the user to click links and find an answer fromredundant text contents, and answers that the user needs can be providedintuitively and clearly, thus deeply satisfying the search servicedemand of the user.

FIG. 4 is a flow chart of a method for locating an answer based onquestion and answer according to another embodiment of the presentdisclosure.

As shown in FIG. 4, based on above embodiments, the method for locatingan answer based on question and answer can further include thefollowings.

In block S15, the matching base is established.

In an embodiment, in order to match the semantic parse tree, it isrequired to establish the matching base prior to matching the semanticparse tree and the matching base.

Specifically, as shown in FIG. 5, the matching base can be establishedby the followings.

In block S151, resources of question and answer pairs are obtained.

The resources of question and answer pairs include query sentencesamples and corresponding answer samples.

The resources of question and answer pairs can be obtained from questionand answer communities or question and answer websites. For example,plentiful resources of question and answer pairs can be obtained fromBaidu Zhidao, 360 question and answer, and other communities.

For example, a query sentence sample is “Why is the sea salty”. Ananswer sample obtained from Baidu Zhidao is “The ocean is salty becausethere is high concentration of salt in the sea. The salt mainly has thefollowing two sources: the first one is that minerals containing saltare brought into rivers and finally into the ocean by an erosion effecton soil and rock on land during a process that rainfalls form runoff;and the second one is that some salt dissolves into the sea bygeological activities (such as volcanoes, seafloor hydrothermal area,and the like) of seafloor itself”. Therefore, the query sentence sampleand the answer sample form a question and answer pair. A set ofplentiful question and answer pairs forms the resources of question andanswer pairs.

It should be noted that, in order to generate the matching base bytraining, it is required to obtain plentiful question and answer pairs,thus forming the resources of question and answer pairs, so as to ensurecomprehensiveness of the matching base.

In block S152, a statistical alignment is performed on the resources ofquestion and answer pairs, to obtain aligned question and answerresources.

In an embodiment, after the resources of question and answer pairs areobtained, the statistical alignment is performed on each of the questionand answer pairs.

Specifically, a global optimal solution for word matching is solved ineach of the question and answer pairs by a machine learning method inthe related art, to obtain an alignment relationship between words in aquery sentence sample and words in an answer sample in a question andanswer pair.

FIG. 6 is a schematic diagram of a statistical alignment result of aquestion and answer pair.

Still taking the question and answer pair “Why is the sea salty” as anexample, it can be seen from FIG. 6 that, a result of the statisticalalignment of the question and answer pair is that “sea” in the querysentence sample matches “ocean” in the answer sample, “why” matches“because” and “is”, “salty” matches “salty”, and so on. In FIG. 6, “ . .. ” represents other parts of the answer sample, which are not listedone by one herein in order to avoid redundancy.

In block S153, a core word is obtained.

In an embodiment, in order to improve accuracy of the statisticalalignment, a core word of each of the query sentence samples in theresources of question and answer pairs. The core word is used to filterwords matching the core word, so as to obtain more accurate statisticalalignment relationships.

Alternatively, the core word can be obtained by related art (such asmachine learning sequence labeling method). A hit degree between a querysentence and an answer sentence can be obtained by covered query ratio(CQR for short). Matching words having a low CQR value and sentencesthat are not hit by the core word are filtered out.

For example, taking example shown in FIG. 6 as an example, an obtainedcore word is “why”, words matching the core word “why” can be calculatedusing CQR method, which are “is” and “because”. It can be determinedthat a CQR value of “because” is higher than a CQR value of “is”,therefore, “is” is filtered out, and a matching word of “why” is“because”.

In block S154, a phrase table is generated according to the alignedresources of question and answer pairs.

In an embodiment, after the core word of the each of the query sentencesamples is obtained, and after the words matching the core word arefiltered to obtain more accurate statistical alignment relationships,the phrase table is generated according to twice aligned resources ofquestion and answer pairs.

Specifically, in the aligned resources of question and answer pairs,words that are able to form a phrase in the query sentence samples forma first set of phrases, and words that are able to form a phrase in theanswer samples form a second set of phrases. The phrase table isgenerated according to the first set of phrases and the second set ofphrases.

In block S155, a probability for being a pair of each of the questionand answer pairs is generated according to the phrase table.

In an embodiment, after the phrase table is obtained, the probabilityfor being a pair of each of the question and answer pairs is generatedaccording to the phrase table.

Specifically, after the phrase table is obtained, the resources ofquestion and answer pairs are analyzed and generalized according to thephrase table by using dependency analysis technology, and theprobability for being a pair of each of the question and answer pairs iscalculated according to an arranged formula.

The resources of question and answer pairs are generalized mainly basedon dependency relationships, part of speech, the phrase table, limitedconditions of regulation, and the like.

For example, the query sentence sample “Why is the sea salty” isgeneralized as “why is A B”, the corresponding answer sample “The oceanis salty because there is high concentration of salt in the sea” isgeneralized as “A is B because”.

After the resources of question and answer pairs are analyzed andgeneralized, the probability for being a pair of each of the questionand answer pairs can be calculated with formula (7), shown as follows:

$\begin{matrix}{{P\left( {QF} \middle| {AF} \right)} = \frac{{Count}\left( {{af},{qf}} \right)}{\sum_{{qf}\; \_ \; i}{{count}\left( {{af},{qf\_ i}} \right)}}} & (7)\end{matrix}$

where, af represents generalized segments in an answer, of representsgeneralized segments in a query sentence, Count(af,qf) represents aco-occurrence frequency of af and qf, and count(af,qf_i) represents aco-occurrence frequency of i^(1h) generalized segment in the querysentence and the generalized segments in an answer.

After the probability for being a pair of each of the question andanswer pairs is obtained, establishment of the matching base iscompleted.

It should be noted that, the process for establishing the matching basein block S15 can be executed at any time before block S13 is executed,and execution time of block S15 is not limited in the presentdisclosure.

With the method for locating an answer based on question and answeraccording to embodiments of the present disclosure, by obtaining theresources of question and answer pairs, performing the statisticalalignment on the resources of question and answer pairs, obtaining thecore word, generating the phrase table according to the alignedresources of question and answer pairs, and generating the probabilityfor being a pair of each of the question and answer pairs to establishthe matching base, a more accurate matching base can be obtained, thusensuring accuracy of the final answer.

In order to realize the above embodiments, the present disclosure alsoprovides a device for locating an answer based on question and answer.FIG. 7 is a schematic diagram of a device for locating an answer basedon question and answer according to an embodiment of the presentdisclosure.

As shown in FIG. 7, the device for locating an answer based on questionand answer according to an embodiment of the present disclosure includesa receiving module 710, a parsing module 720, a matching module 730, anda determining module 740.

The receiving module 710 is configured to receive a query sentence.

The parsing module 720 is configured to parse the query sentence, togenerate a semantic parse tree corresponding to the query sentence.

The matching module 730 is configured to match the semantic parse treewith a pre-established matching base, to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree.

The alignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree includes aword alignment probability or a phrase alignment probability.

Specifically, when the alignment probability between each of candidateanswers in the pre-established matching base and the semantic parse treeis the word alignment probability, the matching module 730 is configuredto obtain an alignment probability of each part of speech in thesemantic parse tree, and to obtain the word alignment probabilityaccording to the alignment probability of each part of speech in thesemantic parse tree.

When the alignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree is the phrasealignment probability, the matching module 730 is configured tocalculate a product of an alignment probability of each of successfullymatching phrases and a number of words in the respective successfullymatching phrase, to obtain a positive probability and a reverseprobability of each of the successfully matching phrases, and to obtaina maximum value from the positive probability and the reverseprobability of each of the successfully matching phrases, and to performa weighted summation on obtained maximum values to obtain the phrasealignment probability. The successfully matching phrases are phrasesthat are successfully matched between candidate answers in thepre-established matching base and the semantic parsing tree.

The determining module 740 is configured to determine a final answeraccording to the alignment probability.

Specifically, the determining module 740 is configured to rank thecandidate answers according to the word alignment probability and/or thephrase alignment probability, and to determine a candidate answer havinga highest ranking score as the final answer.

It should be noted that, the explanation in above embodiments of themethod for locating an answer based on question and answer is alsoapplicable to the embodiments of the device for locating an answer basedon question and answer in this embodiment, with similar implementationprinciple, which is not described here.

With the device for locating an answer based on question and answeraccording to embodiments of the present disclosure, by receiving thequery sentence, parsing the query sentence to generate the semanticparse tree corresponding to the query sentence, matching the semanticparse tree with the pre-established matching base, to obtain thealignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree, anddetermining the final answer according to the alignment probability, itis unnecessary for the user to click links and find an answer fromredundant text contents, and answers that the user needs can be providedintuitively and clearly, thus deeply satisfying the search servicedemand of the user.

FIG. 8 is a schematic diagram of a device for locating an answer basedon question and answer according to another embodiment of the presentdisclosure.

As shown in FIG. 8, based on embodiments shown in FIG. 7, the device forlocating an answer based on question and answer further includes anestablishing module 750.

The establishing module 750 is configured to establish the matchingbase.

Specifically, as shown in FIG. 9, the establishing module 750 includesan obtaining unit 751, an aligning unit 752, a first generating unit753, and a second generating unit 754.

The obtaining unit 751 is configured to obtain resources of question andanswer pairs.

The resources of question and answer pairs include query sentencesamples and corresponding answer samples.

The aligning unit 752 is configured to perform a statistical alignmenton the resources of question and answer pairs, to obtain alignedresources of question and answer pairs.

The first generating unit 753 is configured to generate a phrase tableaccording to the aligned resources of question and answer pairs.

The second generating unit 754 is configured to generate a probabilityfor being a pair of each of the question and answer pairs according tothe phrase table.

It should be noted that, the explanation in above embodiments of themethod for locating an answer based on question and answer is alsoapplicable to the embodiments of the device for locating an answer basedon question and answer in this embodiment, with similar implementationprinciple, which is not described here.

With the device for locating an answer based on question and answeraccording to embodiments of the present disclosure, by obtaining theresources of question and answer pairs, performing the statisticalalignment on the resources of question and answer pairs, obtaining thecore word, generating the phrase table according to the alignedresources of question and answer pairs, and generating the probabilityfor being a pair of each of the question and answer pairs to establishthe matching base, a more accurate matching base can be obtained, thusensuring accuracy of the final answer.

In order to realize the above embodiments, the present disclosure alsoprovides a terminal including one or more processors and a storageconfigured to store executable instructions by the processors. The oneor more processors are configured to execute following blocks.

In block S11′, a query sentence is received.

In block S12′, the query sentence is parsed, to generate a semanticparse tree corresponding to the query sentence.

In block S13′, the semantic parse tree is matched with a pre-establishedmatching base, to obtain an alignment probability between each ofcandidate answers in the pre-established matching base and the semanticparse tree.

In block S14′, a final answer is determined according to the alignmentprobability.

It should be noted that, the explanation in above embodiments of themethod for locating an answer based on question and answer is alsoapplicable to the embodiments of the terminal in this embodiment, withsimilar implementation principle, which is not described here.

With the terminal according to embodiments of the present disclosure, byreceiving the query sentence, parsing the query sentence to generate thesemantic parse tree corresponding to the query sentence, matching thesemantic parse tree with the pre-established matching base, to obtainthe alignment probability between each of candidate answers in thepre-established matching base and the semantic parse tree, anddetermining the final answer according to the alignment probability, itis unnecessary for the user to click links and find an answer fromredundant text contents, and answers that the user needs can be providedintuitively and clearly, thus deeply satisfying the search servicedemand of the user.

In order to realize the above embodiments, the present disclosure alsoprovides a non-transitory computer-readable storage medium, configuredto store one or more programs. When the one or more programs areexecuted by a processor of a mobile terminal, the mobile terminal iscaused to execute a method for locating an answer based on question andanswer according to the embodiments of the first aspect of the presentdisclosure.

With the non-transitory computer-readable storage medium according toembodiments of the present disclosure, by receiving the query sentence,parsing the query sentence to generate the semantic parse treecorresponding to the query sentence, matching the semantic parse treewith the pre-established matching base, to obtain the alignmentprobability between each of candidate answers in the pre-establishedmatching base and the semantic parse tree, and determining the finalanswer according to the alignment probability, it is unnecessary for theuser to click links and find an answer from redundant text contents, andanswers that the user needs can be provided intuitively and clearly,thus deeply satisfying the search service demand of the user.

In order to realize the above embodiments, the present disclosure alsoprovides a program product. When instructions in the program product areexecuted by a processor, the processor is configured to execute a methodfor locating an answer based on question and answer according to theembodiments of the first aspect of the present disclosure.

With the program product according to embodiments of the presentdisclosure, by receiving the query sentence, parsing the query sentenceto generate the semantic parse tree corresponding to the query sentence,matching the semantic parse tree with the pre-established matching base,to obtain the alignment probability between each of candidate answers inthe pre-established matching base and the semantic parse tree, anddetermining the final answer according to the alignment probability, itis unnecessary for the user to click links and find an answer fromredundant text contents, and answers that the user needs can be providedintuitively and clearly, thus deeply satisfying the search servicedemand of the user.

It should be noted that, in the description of the present disclosure,terms such as “first” and “second” in descriptions of the presentdisclosure are used herein for purposes of description and are notintended to indicate or imply relative importance or significance. Inaddition, in the description of the present disclosure, “a plurality of”means two or more than two, unless specified otherwise.

It will be understood that, the flow chart or any process or methoddescribed herein in other manners may represent a module, segment, orportion of code that comprises one or more executable instructions toimplement the specified logic function(s) or that comprises one or moreexecutable instructions of the steps of the progress. And the scope of apreferred embodiment of the present disclosure includes otherimplementations in which the order of execution may differ from thatwhich is depicted in the flow chart, which should be understood by thoseskilled in the art.

It should be understood that the various parts of the present disclosuremay be realized by hardware, software, firmware or combinations thereof.In the above embodiments, a plurality of steps or methods may be storedin a memory and achieved by software or firmware executed by a suitableinstruction executing system. For example, if it is realized by thehardware, likewise in another embodiment, the steps or methods may berealized by one or a combination of the following techniques known inthe art: a discrete logic circuit having a logic gate circuit forrealizing a logic function of a data signal, an application-specificintegrated circuit having an appropriate combination logic gate circuit,a programmable gate array (PGA), a field programmable gate array (FPGA),etc.

Those skilled in the art shall understand that all or parts of the stepsin the above exemplifying method of the present disclosure may beachieved by commanding the related hardware with programs. The programsmay be stored in a computer readable memory medium, and the programscomprise one or a combination of the steps in the method embodiments ofthe present disclosure when run on a computer.

In addition, each function cell of the embodiments of the presentdisclosure may be integrated in a processing module, or these cells maybe separate physical existence, or two or more cells are integrated in aprocessing module. The integrated module may be realized in a form ofhardware or in a form of software function modules. When the integratedmodule is realized in a form of software function module and is sold orused as a standalone product, the integrated module may be stored in acomputer readable memory medium.

The above-mentioned memory medium may be a read-only memory, a magneticdisc, an optical disc, etc.

Reference throughout this specification to “one embodiment”, “someembodiments,” “an embodiment”, “a specific example,” or “some examples,”means that a particular feature, structure, material, or characteristicdescribed in connection with the embodiment or example is included in atleast one embodiment or example of the present disclosure. Thus, theappearances of the phrases in various places throughout thisspecification are not necessarily referring to the same embodiment orexample of the present disclosure. Furthermore, the particular features,structures, materials, or characteristics may be combined in anysuitable manner in one or more embodiments or examples. In addition, ina case without contradictions, different embodiments or examples orfeatures of different embodiments or examples may be combined by thoseskilled in the art.

Although explanatory embodiments have been shown and described, it wouldbe appreciated that the above embodiments are explanatory and cannot beconstrued to limit the present disclosure, and changes, alternatives,and modifications can be made in the embodiments without departing fromscope of the present disclosure by those skilled in the art.

What is claimed is:
 1. A method for locating an answer based on questionand answer, comprising: receiving a query sentence; parsing the querysentence, to generate a semantic parse tree corresponding to the querysentence; matching the semantic parse tree with a pre-establishedmatching base, to obtain an alignment probability between each ofcandidate answers in the pre-established matching base and the semanticparse tree; and determining a final answer according to the alignmentprobability.
 2. The method according to claim 1, further comprising:establishing the matching base.
 3. The method according to claim 2,wherein establishing the matching base comprises: obtaining resources ofquestion and answer pairs, wherein the resources of question and answerpairs comprise query sentence samples and corresponding answer samples;performing a statistical alignment on the resources of question andanswer pairs, to obtain aligned resources of question and answer pairs;generating a phrase table according to the aligned resources of questionand answer pairs; and generating a probability for being a pair of eachof the question and answer pairs according to the phrase table.
 4. Themethod according to claim 1, wherein the alignment probability betweeneach of candidate answers in the pre-established matching base and thesemantic parse tree comprises a word alignment probability.
 5. Themethod according to claim 1, wherein the alignment probability betweeneach of candidate answers in the pre-established matching base and thesemantic parse tree comprises a phrase alignment probability.
 6. Themethod according to claim 4, wherein matching the semantic parse treewith a pre-established matching base to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree comprises: obtaining an alignmentprobability of each part of speech in the semantic parse tree; andobtaining the word alignment probability according to the alignmentprobability of each part of speech in the semantic parse tree.
 7. Themethod according to claim 5, wherein matching the semantic parse treewith a pre-established matching base to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree comprises: calculating a product of analignment probability of each of successfully matching phrases and anumber of words in the respective successfully matching phrase, toobtain a positive probability and a reverse probability of each of thesuccessfully matching phrases, wherein the successfully matching phrasesare phrases that are successfully matched between candidate answers inthe pre-established matching base and the semantic parsing tree; andobtaining a maximum value from the positive probability and the reverseprobability of each of the successfully matching phrases, and performinga weighted summation on obtained maximum values to obtain the phrasealignment probability.
 8. The method according to claim 4, whereindetermining a final answer according to the alignment probabilitycomprises: ranking the candidate answers according to the word alignmentprobability, and determining a candidate answer having a highest rankingscore as the final answer.
 9. The method according to claim 5, whereindetermining a final answer according to the alignment probabilitycomprises: ranking the candidate answers according to the phrasealignment probability, and determining a candidate answer having ahighest ranking score as the final answer.
 10. A device for locating ananswer based on question and answer, comprising: one or more processors;a memory storing instructions executable by the one or more processors;wherein the one or more processors are configured to: receive a querysentence; parse the query sentence, to generate a semantic parse treecorresponding to the query sentence; match the semantic parse tree witha pre-established matching base, to obtain an alignment probabilitybetween each of candidate answers in the pre-established matching baseand the semantic parse tree; and determine a final answer according tothe alignment probability.
 11. The device according to claim 10, whereinthe one or more processors are further configured to: establish thematching base.
 12. The device according to claim 11, wherein the one ormore processors are configured to establish the matching base by actsof: obtaining resources of question and answer pairs, wherein theresources of question and answer pairs comprise query sentence samplesand corresponding answer samples; performing a statistical alignment onthe resources of question and answer pairs, to obtain aligned resourcesof question and answer pairs; generating a phrase table according to thealigned resources of question and answer pairs; and generating aprobability for being a pair of each of the question and answer pairsaccording to the phrase table.
 13. The device according to claim 10,wherein the alignment probability between each of candidate answers inthe pre-established matching base and the semantic parse tree comprisesa word alignment probability.
 14. The device according to claim 10,wherein the alignment probability between each of candidate answers inthe pre-established matching base and the semantic parse tree comprisesa phrase alignment probability.
 15. The device according to claim 13,wherein the one or more processors are configured to match the semanticparse tree with a pre-established matching base, to obtain an alignmentprobability between each of candidate answers in the pre-establishedmatching base and the semantic parse tree by acts of: obtaining analignment probability of each part of speech in the semantic parse tree;and obtaining the word alignment probability according to the alignmentprobability of each part of speech in the semantic parse tree.
 16. Thedevice according to claim 14, wherein the one or more processors areconfigured to match the semantic parse tree with a pre-establishedmatching base, to obtain an alignment probability between each ofcandidate answers in the pre-established matching base and the semanticparse tree by acts of: calculating a product of an alignment probabilityof each of successfully matching phrases and a number of words in therespective successfully matching phrase, to obtain a positiveprobability and a reverse probability of each of the successfullymatching phrases, wherein the successfully matching phrases are phrasesthat are successfully matched between candidate answers in thepre-established matching base and the semantic parsing tree; andobtaining a maximum value from the positive probability and the reverseprobability of each of the successfully matching phrases, and performinga weighted summation on obtained maximum values to obtain the phrasealignment probability.
 17. The device according to claim 13, wherein theone or more processors are configured to determine a final answeraccording to the alignment probability by acts of: ranking the candidateanswers according to the word alignment probability, and determining acandidate answer having a highest ranking score as the final answer. 18.The device according to claim 14, wherein the one or more processors areconfigured to determine a final answer according to the alignmentprobability by acts of: ranking the candidate answers according to thephrase alignment probability, and determining a candidate answer havinga highest ranking score as the final answer.
 19. A non-transitorycomputer-readable storage medium having stored therein instructionsthat, when executed by a processor of a device, cause the processor toperform a method for locating an answer based on question and answer,the method comprising: receiving a query sentence; parsing the querysentence, to generate a semantic parse tree corresponding to the querysentence; matching the semantic parse tree with a pre-establishedmatching base, to obtain an alignment probability between each ofcandidate answers in the pre-established matching base and the semanticparse tree; and determining a final answer according to the alignmentprobability.